
/**
 * Created by qwr on 2017/5/31.
 */
//存cookies函数
export function setCookie(name, value, day) {
  var path = ';path=/;';
  if (day) {
    var Days = day;
    var exp = new Date();
    exp.setTime(exp.getTime() + Days * 24 * 60 * 60 * 1000);
    document.cookie = name + '=' + encodeURIComponent(value) + ';expires=' + exp.toGMTString() + path;
  } else {
    document.cookie = name + '=' + encodeURIComponent(value) + path;
  }
}
// 取cookies函数
export function getCookie(name) {
  var arr = document.cookie.match(new RegExp('(^| )' + name + '=([^;]*)(;|$)'));
  if (arr != null) return decodeURIComponent(arr[2]);
  return null;
}
